package com.oraclejava.activityex;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.Button;

public class ActivityEXActivity extends Activity implements View.OnClickListener {
    /** Called when the activity is first created. */
	Button btn1, btn2, btn3, btn4, btn5, btn6;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.main);        
        btn1 = (Button) findViewById(R.id.button1);
        btn2 = (Button) findViewById(R.id.button2);
        btn3 = (Button) findViewById(R.id.button3);
        btn4 = (Button) findViewById(R.id.button4);
        btn5 = (Button) findViewById(R.id.button5);
        btn6 = (Button) findViewById(R.id.button6);
        
        btn1.setOnClickListener(this);
        btn2.setOnClickListener(this);
        btn3.setOnClickListener(this);
        btn4.setOnClickListener(this);
        btn5.setOnClickListener(this);
        btn6.setOnClickListener(this);
    }

	@Override
	public void onClick(View v) {
		int id = v.getId();
		Intent intent=null;
		switch(id){
		case R.id.button1:
			intent = new Intent("android.intent.action.VIEW", Uri.parse("http://m.naver.com/"));
			startActivity(intent);
			break;
		case R.id.button2:
			intent = new Intent("android.intent.action.VIEW", Uri.parse("geo:0,0?q=Seoul"));
			startActivity(intent);
			break;
		case R.id.button3:
			intent = new Intent("android.intent.action.CALL", Uri.parse("tel:010-123-1234"));
			startActivity(intent);
			break;
		case R.id.button4:
			intent = new Intent("android.intent.action.DIAL", Uri.parse("tel:010-123-1234"));
			startActivity(intent);
			break;
		case R.id.button5:
			intent = new Intent("android.intent.action.VIEW", Uri.parse("smsto:010-123-1234"));
			intent.putExtra("address", "010-123-1234");
			intent.putExtra("sms_body", "TEST MESSAGE");
			startActivity(intent);
			break;
		case R.id.button6:
			intent = new Intent("android.settings.SETTINGS");
			startActivity(intent);
			break;
		}
	}
    
}